/*
 ============================================================================
 Name        : YuebaoReaderCanvas
 Author      :
 Version     :
 Copyright   : Your copyright notice
 Description :
 ============================================================================
 */

#ifndef YuebaoSearchCanvas_H
#define YuebaoSearchCanvas_H

// INCLUDES
#include <e32std.h>
#include "fCanvas.h"
#include "YuebaoCanvasTemplate.h"
#include "fToolbar.h"
#include "fListbox.h"
#include "HttpEngine.h"

class YuebaoCanvasManager;
class CResponseSearch;

class YuebaoSearchCanvas : public fCanvas, public HttpEngineObserver, public fListboxEventObserver
{
public:
    static YuebaoSearchCanvas* NewLC( fEngine* aFramework, MCanvasManager* aManager, int canvasID );
    static YuebaoSearchCanvas* NewL( fEngine* aFramework, MCanvasManager* aManager, int canvasID );
    virtual ~YuebaoSearchCanvas( );
protected:
    YuebaoSearchCanvas( MCanvasManager* aManager, int canvasID );
    void ConstructL( fEngine* aFramework );
protected:
    void RenderFrame( );
    void HandleKey( f_KEY_DES* aKeyDes );
    TInt HandleMouse( fMouseEvent nType, TPoint sPoint );
protected:
    void SwitchToCanvas( const TDesC& aCommandline, void* data );
    void SwitchFromCanvas( );
    void SwitchBack( );
protected:
    fListbox* _listBox;
    YuebaoCanvasTemplate* _canvasStyle;
    fToolbar* iCommandBar;
protected:
    void ListboxItemClicked( fListbox* pListBox, int selectIndex, fListBoxItem* pItemInfo );
protected:
    HBufC* _Message;
protected:
    CFont* _font;
protected:
    CHttpEngine* iNetEngine;
protected:
    // void HttpClientEvent(TInt aEventCode);
    //void HttpHeadReceived(const TDesC8& aHeadData);
    //void HttpBodyReceived(const TDesC8& aBodyData);
    void HttpFinished( const CHttpEngine& engine, int finishedReason, const TDesC8& aBodyData );
    char* HttpEngineObserverID( )
    {
        return "searchCanvas";
    }
private:
    CResponseSearch* _search;
private:
    HBufC* _keyword;
private:
    void SetWindowTitle( const TDesC& aTitle );
};

#endif // YuebaoSearchCanvas_H
